import Vue from 'vue'
import VueRouter from 'vue-router'
import MyLogin from '../views/login-register/Login.vue'
import MyRegister from '../views/login-register/Register.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'MyLogin',
    component: MyLogin,
  },
  {
    path: '/register',
    name: 'MyRegister',
    component: MyRegister,
  },
  {
    path: '/homePage',
    name: 'HomePage',
    component: () => import("../views/homePage/HomePage.vue"),
    children:[
      /* 文件管理 */
      {
        path: '/filePage',
        name: 'FilePage',
        component: () => import('../views/file/filePage.vue'),
        children:[
          {
            path: '/clientFile',
            name: 'ClientFile',
            component: () => import('../views/file/clientFile.vue'),
          },
          {
            path: '/interiorFile',
            name: 'InteriorFile',
            component: () => import('../views/file/interiorFile.vue'),
          }
        ]
      },
      /* 考勤管理 */
      {
        path: '/checkPage',
        name: 'CheckPage',
        component: () => import('../views/checkOnWorkAttendance/checkPage.vue'),
        children:[
          {
            path: '/attendanceRecord',
            name: 'AttendanceRecord',
            component: () => import('../views/checkOnWorkAttendance/attendanceRecord.vue'),
          },
          {
            path: '/leaveForm',
            name: 'LeaveForm',
            component: () => import('../views/checkOnWorkAttendance/leaveForm.vue'),
          },
          {
            path: '/leaveRecord',
            name: 'LeaveRecord',
            component: () => import('../views/checkOnWorkAttendance/leaveRecord.vue'),
          },
          {
            path: '/punchCard',
            name: 'PunchCard',
            component: () => import('../views/checkOnWorkAttendance/punchCard.vue'),
          }
        ]
      },
      /* 业绩管理 */
      {
        path: '/performancePage',
        name: 'PerformancePage',
        component: () => import('../views/performance/performancePage.vue'),
        children:[
          {
            path: '/performanceRecord',
            name: 'PerformanceRecord',
            component: () => import('../views/performance/performanceRecord.vue'),
          }
        ]
      },
      {
        path: '/homePageIndex',
        name: 'HomePageIndex',
        component: () => import('../views/homePage/HomePageIndex.vue'),
      },
      {
        path: '/firstPageIndex',
        name: 'FirstPageIndex',
        component: () => import('../views/firstPage/FirstPageIndex.vue'),
      },
      {
        path: '/customerPage',
        name: 'CustomerPage',
        component: () => import('../views/customerServiceSystem/CustomerPage.vue'),
        children:[
          {
            path: '/customerSearch',
            name: 'CustomerSearch',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/CustomerSearch.vue'),  
          },
          {
            path: '/customerRelationship',
            name: 'CustomerRelationship',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/CustomerRelationship.vue'),  
          },
          {
            path: '/customerMsgSupple',
            name: 'CustomerMsgSupple',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/CustomerMsgSupple.vue'),  
          },
          {
            path: '/basicInfomation',
            name: 'BasicInfomation',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/customerInformation/BasicInformation.vue'),  
          },
          {
            path: '/holdingProduct',
            name: 'HoldingProduct',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/customerInformation/HoldingProduct.vue'),  
          },
          {
            path: '/relatePerson',
            name: 'RelatePerson',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/customerInformation/RelatedPerson.vue'),  
          },
          {
            path: '/transActionRecord',
            name: 'TransActionRecord',
            component: () => import('../views/customerServiceSystem/customerServiceColumn/customerInformation/TransactionRecord.vue'),  
          },
        ]
      },
      {
        path: '/conferenceManage',
        name: 'ConferenceManage',
        component: () => import('../views/conferenceManage/Conference.vue'),
        children:[
          {
            path: '/onlineCommunicate',
            name: 'OnlineCommunicate',
            component: () => import('../views/conferenceManage/OnlineCommunicate.vue'),
          },
          {
            path: '/conferenceRoom',
            name: 'ConferenceRoom',
            component: () => import('../views/conferenceManage/ConferenceRoom.vue'),
          },
          {
            path: '/conferenceReservation',
            name: 'ConferenceReservation',
            component: () => import('../views/conferenceManage/ConferenceReservation.vue'),
          },
        ]
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  linkActiveClass: 'is-active',
  routes,
})

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
